<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<title><?=$sys['web_site_title'];?></title>
    <meta name='keywords' content='<?=$sys['web_site_keywords'];?>'>
    <meta name='description' content='<?=$sys['web_site_description'];?>'>
    <link rel='stylesheet' type='text/css' href='/static/www/pc.css?v=<?=env('version')?>'>
    <link rel='stylesheet' type='text/css' href='/static/www/lib.css?v=<?=env('version')?>'>
    <script src="https://cdn.bootcss.com/jquery/1.11.2/jquery.min.js?v=<?=env('version')?>"></script>
    <script type='text/javascript' src='/static/www/lib.js?v=<?=env('version')?>'></script>
    <script type='text/javascript' charset='UTF-8' src='/static/www/pc.js?v=<?=env('version')?>'></script>
	<script type="text/javascript" src="/static/admin/common/layui/layui.js?v=<?=env('version')?>"></script>
	<script type="text/javascript" src="/static/vendor/function.js?v=<?=env('version')?>"></script>
</head>
<style>
.form_box .form_inpt{
  margin-top: 10px
}
.inner_from .form_box{
  top:30px;
}
</style>
<body>
<div class="ufrom_header">
	<div class="logo w1200">
    	<a href="/index/"><img src="<?=$com['img']['login_logo']['pic'];?>"></a><span>用户注册</span>
    </div>
</div>
<!--登录中间层开始-->
<div class="ufrom_content">
  <div class="inner_from w1200">
    <div class="from_pic">
		<img src="<?=$com['img']['login_ad']['pic'];?>">
	</div>
    <div class="form_box" style="height: 380px;">
     <div id="inner2" class="inner" style="display:block">
      <form name="usLoginForm" class="layui-form" action=''>
          <div class="form_title">用户注册<a href="/publics/login" class="href">已有账号？去登录！</a></div>
          <div class="form_inpt"> <span class="form_label" title="请输入手机号"><i class="userName"></i></span>
            <input name="username" type="text" required lay-verify="required" class="write_text" maxlength="20">
            <span class="placeholder">帐号昵称</span> </div>
            <div class="form_inpt"> <span class="form_label" title="请输入帐号昵称"><i class="userName"></i></span>
              <input name="userphone" type="text" required lay-verify="required" class="write_text" maxlength="20">
              <span class="placeholder">请输入手机号</span> </div>
          <div class="form_inpt"> <span class="form_label"><i class="Pwd"></i></span>
            <input name="password" type="password" required lay-verify="required" class="write_text" maxlength="20">
            <span class="placeholder">设置密码</span> <i class="setType_btn" title="查看密码"></i></div>

            <div class="form_code">
              <input name="imgcode" type="text" class="write_don" maxlength="6"  required lay-verify="required" placeholder="图形验证码">
              <a href="javascript:;" class="code_btn"><img src="<?=url('publics/captcha')?>" id="ProveImg" onclick="this.src='<?=url('publics/captcha')?>?t='+Math.random()" title='换一张' style="cursor: pointer;"></a>
              <div class="clear"></div>
            </div>

          <div class="form_code">
            <input name="code" type="text" required lay-verify="required" aria-label="输入验证码" class="write_don" maxlength="20" placeholder="短信验证码">
            <button type="button" class="post_btn_code" lay-ignore style="background:#999999" onclick="sendsms(this,60,'register')">获取验证码</button>
            <div class="clear"></div>
          </div>
          <div class="form_check">
            <input name="agreement" type="checkbox" lay-ignore id="agreementId" class="form_checked" value="yes">
            <span class="radius">
            <label for="agreementId">阅读并接受</label>
            <a target="_blank" href="/article/detail?id=3" class="aritc">《注册协议》</a></span>
        </div>
          <div class="form_submit">
            <input type="button" id="form_btn" lay-filter="myform" style="background:#dddddd" class="form_btn" value="立即注册">
          </div>
      </form>
      </div
    </div>
  </div>
</div>

<!--底部-->
<!--底部-->
<div class='footer'>
	<div class='w1200'>
<?php include_once __DIR__.'/../inc/bottom.html';?>
	</div>
</div>
</body>
</html>
  <script type='text/javascript'>
	$('[name="agreement"]').click(function(){
		var obj = $("#form_btn");
		if($(this).is(":checked")){
			obj.css("background","#e4393c");
			obj.attr("lay-submit","");
		}else{
			obj.css("background","#dddddd");
			obj.removeAttr("lay-submit");
		}
	});
  //发送短信
  function sendsms(e,second,type){
      var phone = $('[name="userphone"]').val();
    var ext = $("[name='username']").val();
	  var imgcode = $("[name='imgcode']").val();
	  var password = $("[name='password']").val();
      var reg = /^1[0-9]{10}$/;
      if(!reg.test(phone)){
          layer.msg('请填写正确的手机号');
		  return false;
      }
      if(!ext){
          layer.msg('请填写用户名称');
		      return false;
      }
      if(!password || password.length<6){
          layer.msg('密码长度至少6位数');
		      return false;
      }
      if(!imgcode){
          layer.msg('请填写图形验证码');
          return false;
      }
    	$.ajax({
    		url:"<?=url('publics/sendSms');?>",
    		method:"post",
    		dataType:"json",
    		data:{phone:phone,type:type,ext:ext,imgcode:imgcode},
    		success:function(rs){
                if(rs.code!=0){
                    _action(rs);
                    return false;
                }
    			$(e).attr("disabled");
    			$(e).text("重新发送(" + second + ")");
                var index = setInterval(function(rs) {
    				countdown = parseInt(/(\d+)/gi.exec($(e).text()));
    				if (countdown == 0) {
    	                $(e).removeAttr("disabled");
    	                $(e).text("获取验证码");
    					clearInterval(index);
    	                return false;
    	            } else {
    	                $(e).attr("disabled", true);
    	                countdown--;
    	                $(e).text("获取验证码(" + countdown + ")");
    	            }
                },1000);
    		}
    	});
    }
  </script>
